/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Apogeesrc;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JWindow;
import javax.swing.SwingConstants;

/**
 *
 * @author ChuaJefferson
 */
public class Openscrn extends JWindow
{
   	public Openscrn(int time)
	{
		JPanel mains = new JPanel(new BorderLayout());
		ImageIcon icon = new ImageIcon("Apogee.jpg");

		mains.add(new JLabel(icon, SwingConstants.CENTER));
		getContentPane().add(mains);

                //Show the window
		this.addMouseListener(new MouseAdapter(){
			public void mousePressed(MouseEvent me)
			{
				dispose();
			}
		});
		pack();
		centerScreen();
		show();
		if(time !=0) {
			try {
				Thread.sleep(time);
				dispose();
			} catch(InterruptedException ie){}
		}

	}
	//Simple method to center in screen
	public void centerScreen()
	{
		Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
		int x = (int) ((d.getWidth() - getWidth()) / 2);
		int y = (int) ((d.getHeight() - getHeight()) / 2);
		setLocation(x, y);
	}

}



